﻿using System;
using System.Collections.ObjectModel;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ArchitectingInnovation.PRISMvvM.Core.Converters
{
    public class EnumConverterHelper
    {
        
            public ObservableCollection<EnumKeyValue> GetValues(Type t)
            {
                return GetValues(t, false);
            }

            public ObservableCollection<EnumKeyValue> GetValues(Type t, bool insertEmptySelection)
            {
                var list = new ObservableCollection<EnumKeyValue>();
                foreach (var o in t.GetFields())
                {
                    if (o.IsSpecialName)
                        continue;
                    list.Add(new EnumKeyValue(Enum.Parse(t, o.Name, true)));
                }
                if (insertEmptySelection)
                    list.Insert(0, new EnumKeyValue(null));

                return list;
            }


            
    }
}
